import { execute } from '@/store/baseAction'
import * as replyApi from '@/api/reply'

// 评论
export function review (context, payload) {
    return execute(replyApi.review(payload))
}

// 删除评论
export function deleteReply (context, payload) {
    return execute(replyApi.deleteReply(payload))
}

// 根据评论Id获取评论
export function getById (context, postId) {
    return execute(replyApi.getById(postId))
}

// 分页获取当前用户的评论
export function pageCurrentReplies (context, payload) {
    return execute(replyApi.pageCurrentReplies(payload))
}

// 分页获取帖子的评论
export function pageReply (context, payload) {
    return execute(replyApi.pageReply(payload))
}

// 投票
export function vote (context, payload) {
    return execute(replyApi.vote(payload))
}

// 取消投票
export function removeVote (context, payload) {
    return execute(replyApi.removeVote(payload))
}

// 获取当前用户的所有的投票
export function currentVotes (context) {
    return execute(replyApi.currentVotes(), data => {
            context.commit('setVotes', data)
        }
    )
}
